package objectfocus;

import java.util.ArrayList;

public class StudentDemo {
    public static void main(String[] args) {
        Student s = new Student("张三","男",18);
        Student.teacherName ="王老师";
        //s1.teacherName = "王老师";
        s.setAge(24);
        s.show();
        s.someOneStudy();
        Student s1 = new Student("李四","女",18);
        s1.setAge(26);
        s1.show();
        s1.someOneStudy();
        int[] arr = {1,2,3,4,5,6,7,8,9,13} ;
        // 调用工具类的方法
        ArrayUtil.printArray(arr);
        int max = ArrayUtil.getMax(arr);
        int sum = ArrayUtil.getSum(arr);
        float avg = ArrayUtil.getAvg(arr);
        System.out.println("最大值为：" + max);
        System.out.println("总和为：" + sum);
        System.out.println("平均值为：" + avg);

        Student s3 = new Student("王五","男",20);
        Student s4 = new Student("赵六","女",22);
        ArrayList<Student> list = new ArrayList<Student>();
        list.add(s);
        list.add(s1);
        list.add(s3);
        list.add(s4);
        int maxGender = ArrayUtil.getMaxGenter(list);
        System.out.println("年龄最大的学生是："+list.get(maxGender).getName()+list.get(maxGender).getAge());
    }
}
